﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="GoodsTravelDaysManagement.aspx.cs" Inherits="NetDon.OA.Portal.Admin.GoodsTravelDaysManagement" %>

<%@ Import Namespace="NetDon.OA.Interface" %>
<%@ Import Namespace="NetDon.OA.Portal" %>
<%@ Import Namespace="NetDon.Utilities" %>
<%@ Register TagPrefix="uc1" TagName="GridPager" Src="~/Controls/GridPager.ascx" %>
<%@ Register TagPrefix="uc2" TagName="ComanyDepartment_1" Src="~/Components/ProvinceCity.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">

        function createCustomer() {

            $dialog('<%= ResolveUrl("~/Admin/GoodsTravelDaysEdit.aspx") %>', { width: 800, height: 320 }, function (result) {
                if (result) {
                    $get('<%=btnReload.ClientID %>').click();
                }
            });
        }

        function modifyCustomer(id) {
            $dialog(String.format('<%=ResolveUrl("~/Admin/GoodsTravelDaysEdit.aspx") %>?Id={0}', id), { width: 800, height: 320 }, function (result) {
                if (result) {
                    $get('<%=btnReload.ClientID %>').click();
                }
            });
        }

        function deleteDemand(ContactKey) {
            $confirm('确定要删除该在途天数信息吗?', function (result) {
                if (result) {
                    $text($get('<%=fieldCustomerId.ClientID %>'), ContactKey);
                    $get('<%=btnDeleteDemand.ClientID %>').click();
                }
            });
        }
   
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server" DefaultButton="btnSearch">
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <tr>
                        <td>
                            <NetDon:FormPanel ID="PanelCondition" runat="server" CaptionAlign="NotSet" RepeatColumns="2">
                                <Items>
                                    <NetDon:FormItem HeaderText="线路分类">
                                        <ContentTemplate>
                                            <asp:DropDownList ID="ddlRouteTypeId" DataSourceID="ddsRouteTypeId" AppendDataBoundItems="True"
                                                runat="server" DataTextField="Name" DataValueField="Value">
                                            </asp:DropDownList>
                                            <NetDon:DictionaryDataSource ID="ddsRouteTypeId" runat="server" CategoryName="线路分类"
                                                EmptyItemType="Select">
                                            </NetDon:DictionaryDataSource>
                                        </ContentTemplate>
                                    </NetDon:FormItem>
                                    <NetDon:FormItem HeaderText="送货省份">
                                        <ContentTemplate>
                                            <uc2:ComanyDepartment_1 ID="ucProvinceCity" runat="server"></uc2:ComanyDepartment_1>
                                        </ContentTemplate>
                                    </NetDon:FormItem>
                                </Items>
                            </NetDon:FormPanel>
                        </td>
                        <td valign="bottom">
                            <asp:Button runat="server" ID="btnSearch" Text="查询" OnClick="btnSearch_Click" />
                            <asp:Button runat="server" ID="btnCreateNew" Text="新增" OnClientClick="createCustomer();return false;" />
                        </td>
                    </tr>
                </table>
                <div style="margin-top: 10px">
                    <NetDon:GridView ID="gridCustomerInfoList" runat="server" AutoGenerateColumns="False"
                        AllowSorting="true">
                        <Columns>
                            <NetDon:TemplateField HeaderText="线路分类" SortExpression="RouteTypeId">
                                <ItemTemplate>
                                    <%#GetDictionaryItemName(Eval("RouteTypeId"))%>
                                </ItemTemplate>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="送货省份" SortExpression="DeliveryProvince">
                                <ItemTemplate>
                                    <%#Eval("DeliveryProvinceName")%>
                                </ItemTemplate>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="送货城市" SortExpression="DeliveryCity">
                                <ItemTemplate>
                                    <%#Eval("DeliveryCityName")%>
                                </ItemTemplate>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="货物在途天数" SortExpression="GoodsTravelDays">
                                <ItemTemplate>
                                    <%#GetGoodsTravelDays(Eval("GoodsTravelDays"), Eval("GoodsTravelDaysUnit"))%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="回单在途天数" SortExpression="ReceiptOnWayDays">
                                <ItemTemplate>
                                    <%#GetGoodsTravelDays(Eval("ReceiptOnWayDays"), Eval("ReceiptOnWayDaysUnit"))%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="成本单价" SortExpression="UnitCost">
                                <ItemTemplate>
                                    <%#!MiscUtilities.IsNullOrEmpty(Eval("UnitCost")) ? Convert.ToDecimal(Eval("UnitCost")).ToString("#,###.0000") : ""%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="营收单价" SortExpression="RevenueUnitCost">
                                <ItemTemplate>
                                    <%#!MiscUtilities.IsNullOrEmpty(Eval("RevenueUnitCost")) ? Convert.ToDecimal(Eval("RevenueUnitCost")).ToString("#,###.00") : ""%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            </NetDon:TemplateField>
                            <NetDon:TemplateField HeaderText="操作" ItemStyle-Width="80px">
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnEdit" Style="margin-left: 5px" ToolTip="Edit" runat="server"
                                        CommandName="Edit" SkinID="Modify" ImageAlign="AbsMiddle" CausesValidation="false"
                                        OnClientClick='<%# Eval("Id","modifyCustomer(\"{0}\");return false;") %>' />
                                    <asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" SkinID="Delete" ImageAlign="AbsMiddle"
                                        CausesValidation="false" CommandName="DeleteCustomer" CommandArgument='<%# Eval("Id") %>'
                                        OnClientClick='<%# Eval("Id","deleteDemand(\"{0}\");return false;") %>' />
                                </ItemTemplate>
                            </NetDon:TemplateField>
                        </Columns>
                    </NetDon:GridView>
                    <asp:Button ID="btnReload" runat="server" SkinID="Hidden" OnClick="btnReload_Click" />
                    <asp:HiddenField ID="fieldCustomerId" runat="server" />
                    <asp:Button ID="btnDeleteDemand" runat="server" OnClick="btnDeleteDemand_Click" Text="Delete"
                        SkinID="Hidden" />
                    <uc1:GridPager ID="PageQueryAdapter1" runat="server" TargetControlID="gridCustomerInfoList"
                        PageSize="20" OnPerformGetCondition="PageQueryAdapter1_PerformGetCondition" OnPerformGetRecordCount="PageQueryAdapter1_PerformGetRecordCount"
                        OnPerformGetPageData="PageQueryAdapter1_PerformGetPageData" />
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
